Methods for Identifying Denial Constraints

ABSTRACT

Computer implemented methods for identifying denial constraints are provided herein. The denial constraints can be used with a database schema R. A predicate space P can be generated for an instance I in the schema R. An evidence set Evi I  can be generated. The evidence set Evi I  can include sets of satisfied predicates in the predicate space P for each instance I. A minimal set of predicates can be identified for the evidence set Evi I . Valid denial constraints can be identified from the minimal set by inverting the predicates in the minimal set.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a National stage entry under 35 U.S.C. §371 of PCT Patent Application No. PCT/EP2013/061326, filed May 31, 2013, which is incorporated entirely by reference herein.

BACKGROUND

The present disclosure relates to a method for identifying denial constraints, the denial constraints being used in multiple applications, including but not limited to for use in reviewing data, sanity checking data, identifying errors and/or correcting errors in data stored in a database.

As businesses generate and consume data more than ever, it is critical to enforce and maintain the quality of the data assets. One in three business leaders does not trust the information used to make decisions, since establishing trust in data becomes a challenge as the variety and the number of sources grow. For example, in healthcare domains, inaccurate or incorrect data may threaten patient safety. Therefore, data review, validation and/or cleaning is a task towards improving data quality, which is estimated to account for 30%-80% of the cost of a typical data warehouse project.

Integrity constraints (ICs), originally designed to improve the quality of a database schema, have been recently repurposed towards improving the quality of data, either through checking the validity of the data at points of entry, or by cleaning the data at various points during the processing pipeline. Traditional types of ICs, such as key constraints, check constraints, functional dependencies (FDs), and their extension conditional functional dependencies (CFDs) have been proposed for data quality management. However, there is still a large space of ICs that cannot be captured using the aforementioned types.

SUMMARY Example 1 Consider the US tax records in Table 1 shown in

FIG. 1. Each record describes an individual address and tax information with 15 attributes: first and last name (FN, LN), gender (GD), area code (AC), mobile phone number (PH), city (CT), state (ST), zip code (ZIP), marital status (MS), has children (CH), salary (SAL), tax rate (TR), tax exemption amount if single (STX), married (MTX), and having children (CTX).

Suppose that the following constraints hold: (1) there cannot exist two persons who have the same area code and phone; (2) there cannot exist two persons who live in the same zip code with different states; (3) there cannot exist a person who lives in Los Angeles but not in California; (4) there cannot exist two persons who live in the same state, but one person earns less salary and has higher tax rate at the same time; and (5) there cannot exist any person whose single tax exemption is greater than salary.

Constraints (1), (2), and (3) can be expressed as a key constraint, an FD, and a CFD.

(1): {AC, PH} (2): ZIP→ST (3): [CT=‘Los Angeles’]→[ST=‘CA’]

Since Constraints (4) and (5) involve order predicates (>, <), and (5) compares different attributes in the same predicate, they cannot be expressed by FDs and CFDs. However, they can be expressed in first-order logic:

∀t _(α) ,t _(β) ∈r, ^(┐)(t _(α) ·ST=t _(β)·ST

t_(α)·SAL<t_(β)·SAL

t_(α)·TR>t _(β)·TR)  c₄:

∀t _(α) ∈r, ^(┐)(t _(α)·SAL<t_(α)·STX)  c₅:

Since first-order logic is more expressive, Constraints (1)-(3) can also be expressed as follows:

∀t _(α) ,t _(β) ∈r, ^(┐)(t _(α)·AC=t _(β)·AC

t _(α)·PH=t _(β)·PH)  c₁:

∀t _(α) ,t _(β) ∈r, ^(┐)(t _(α)·ZIP=t _(β)·ZIP

t _(α)·ST≠t _(β)·ST)  c₂:

∀t _(α) ,t _(β) ∈r, ^(┐)(t _(α)·CT=‘Los Angeles’

t _(α)·ST≠‘CA’)·  c₃:

The more expressive power an IC language has, the harder it is to exploit, for example, in automated data cleaning algorithms or in writing SQL queries for consistency checking. There is an infinite space of business rules up to ad-hoc programs for enforcing correct application semantics and business logic. There is a need to achieve a balance between the expressive power of ICs to deal with a broader space of business rules and, the restrictions required to ensure adequate static analysis of ICs and the development of effective cleaning and discovery algorithms.

Denial Constraints (DCs), are a universally quantified first order logic formalism, that can express all constraints in Example 1 since DCs are more expressive than key constraints, FDs, and CFDs. DCs serve as a good compromise between expressiveness and complexity for the following reasons: (1) DCs are defined on predicates that can be easily expressed in SQL queries for consistency checking; (2) DCs have been proven to be a useful language for data cleaning in many aspects, such as data repairing, consistent query answering, and expressing data currency rules; and (3) while static analysis of DCs is un-decidable, it is possible to develop a set of sound inferences rules and a linear implication testing algorithm for DCs that enable an efficient adoption of DCs as an IC language.

Conventional methods which use DCs as a language formalism for data quality management do not, however, provide a suitable method for acquiring DCs. While DCs can be obtained by consulting domain experts, this is a time consuming and expensive process which requires expertise in the constraint language at hand. Moreover, such rules can introduce mistakes due to human error, or the rules may even be impossible to design when an expert for a new domain is not available.

The present disclosure seeks to provide an improved method for identifying denial constraints.

According to one aspect of the present disclosure, there is provided a method of identifying denial constraints, the denial constraints being for use with a database schema R, the method comprising: generating a predicate space P for an instance I in the schema R, generating an evidence set Evi_(I) which comprises sets of satisfied predicates in the predicate space P for each instance I, identifying a minimal set of predicates for the evidence set Evi_(I), and identifying valid denial constraints from the minimal set by inverting the predicates in the minimal set.

According to one or more embodiments described herein, generating the predicate space P comprises: for each attribute in the schema R, adding equality predicates describing equality and inequality between two tuples on an attribute and adding cross column predicates for joinable column pairs, for each numerical attribute in the schema R, adding order predicates describing greater than, greater than or equal to, less than or equal to, or less than between two tuples on an attribute, and adding cross column order predicates for comparable column pairs.

According to one or more embodiments described herein, the predicate space P is generated using the algorithm:

Input: One relational instance I, schema R Output: Predicate space P  1: for all A ∈ R do  2: P ← t_(α).Aθt_(β).A, where θ ∈ {=, ≠}  3: if A is numerical type then  4: P ← P + tα .Aθtβ .A, where θ ∈ {>, ≦, <, ≧}  5: Profiling to find joinable column pairs EQColPairs  6: for all 

 A, B 

 ∈ EQColPairs do  7: P ← P + t_(α).Aθt_(α).B, where θ ∈ {=, ≠}  8: P ← P + t_(α).Aθt_(β).B, where θ ∈ {=, ≠}  9: Profiling to find comparable column pairs OrderColPairs 10: for all 

 A, B 

 ∈ OrderColPairs do 11: P ← P + t_(α).Aθt_(α).B, where θ ∈ {>, ≦, <, ≧} 12: P ← P + t_(α).Aθt_(β).B, where θ ∈ {>, ≦, <, ≧}.

According to one or more embodiments described herein, the evidence set Evi_(I) is generated using the algorithm:

Input: One relational instance I, predicate space P Output: Evi_(I)  1: for Tuple t_(x) ∈ I do  2: for Tuple t_(y) ∈ I do  3: if t_(x) = t_(y) then  4: continue  5: SAT ← ø  6: for P ∈ P do  7: if 

 t_(x),t_(y) 

 |= P then  8: SAT ← SAT + P  9: if SAT ∉ Evi_(I) then 10: Evi_(I) ← Evi_(I) + SAT.

According to one or more embodiments described herein, the method further comprises dividing the space of the valid denial constraints into a plurality of subspaces that each comprise a first predicate P₁.

According to one or more embodiments described herein, the method further comprises dividing the plurality of subspaces into a plurality of further subspaces that each comprise a second predicate P₂.

According to one or more embodiments described herein, the method further comprises ordering the valid denial constraints in a taxonomy tree according to the predicates in each denial constraint.

According to one or more embodiments described herein, the method further comprises searching for denial constraints by searching the taxonomy tree from the bottom-up.

According to one or more embodiments described herein, the method further comprises pruning branches from the taxonomy tree which comprise valid denial constraints identified by the search and performing a further search of the taxonomy tree from the bottom-up.

According to one or more embodiments described herein, the method further comprises providing a scoring function to provide a ranking of discovered denial constraints.

According to one or more embodiments described herein, the scoring function comprises assigning an interestingness score Inter(φ) to each denial constraint φ, the score Inter(φ) being a weighted combination of the succinctness and coverage of each denial constraint φ.

According to one or more embodiments described herein, a U-Precision metric is provided which identifies whether a denial constraint is schema-conforming:

${{U\text{-}{{Precision}\left( \Sigma_{S} \right)}} = \frac{\Sigma_{u}}{\Sigma_{s}}},$

where the discovered DCs are denoted by Σ_(s) and Σ_(u) is the DCs in Σ_(s) that are verified as gold standard.

According to one or more embodiments described herein, the succinctness is defined as:

${{Succ}(\phi)} = \frac{{Min}\left( \left\{ {{Len}(\varphi)} \middle| {\forall\varphi} \right\} \right)}{{Len}(\phi)}$

According to one or more embodiments described herein, the coverage is defined as:

${{Coverage}(\phi)} = \frac{\sum_{k = 0}^{{{\phi \cdot {Pres}}} - 1}{{{kE}}*{w(k)}}}{{I} \times \left( {{I} - 1} \right)}$

According to one or more embodiments described herein, approximate DCs are identified by: given a relational schema R and instance I, finding a minimal cover Σ of valid DCs, where a DC φ is valid if the percentage of violations of φ on I, i.e., number of violations of φ on I divided by total number of tuple pairs |I|(|I|−1), is within a threshold ∈.

According to another aspect of the present disclosure, there is provided a system operable to identify denial constraints, the denial constraints being for use with a database schema R, the system comprising: a mechanism operable to generate a predicate space P for an instance I in the schema R, a mechanism operable to generate an evidence set Evi_(I) which comprises sets of satisfied predicates in the predicate space P for each instance I, a mechanism operable to identify a minimal set of predicates for the evidence set Evi_(I), and to identify valid denial constraints from the minimal set by inverting the predicates in the minimal set.

BRIEF DESCRIPTION OF THE DRAWINGS

The embodiments set forth in the drawings are illustrative and exemplary in nature and not intended to limit the subject matter defined by the claims. The following detailed description of the illustrative embodiments can be understood when read in conjunction with the following drawings, where like structure is indicated with like reference numerals and in which:

FIG. 1 depicts table (Table 1) showing data representing US tax records for Example 1 according to one or more embodiments shown and described herein;

FIG. 2 depicts table (Table 3) of FDs Axioms and their corresponding DCs forms according to one or more embodiments shown and described herein;

FIG. 3 shows a soundness proof and completeness proof of the algorithms of an interference system according to one or more embodiments shown and described herein;

FIG. 4 shows a soundness proof for Algorithm 1 according to one or more embodiments shown and described herein;

FIG. 5 shows a soundness proof for Algorithm 2 and a counterexample for Algorithm 2 according to one or more embodiments shown and described herein;

FIG. 6 schematically depicts diagram of an example taxonomy tree according to one or more embodiments shown and described herein;

FIG. 7 schematically depicts algorithm (Algorithm 7) to search ∈-minimal covers according to one or more embodiments shown and described herein;

FIGS. 8a-l depict graphical representations of the results of a scalability evaluation with respective example datasets for a FASTDC embodiment according to one or more embodiments shown and described herein; and

FIG. 9 depicts table (Table 5) showing sample denial constraints identified in the example datasets according to one or more embodiments shown and described herein.

DETAILED DESCRIPTION

1.1 Challenges with Identifying Denial Constraints

Three main technical challenges hinder the adoption of DCs as an efficient IC language and in discovering DCs from an input data instance:

(1) Theoretical Foundation

The necessary theoretical foundations for DCs as a constraint language are missing. Armstrong Axioms and their extensions are at the core of state-of-the-art algorithms for inferring FDs and CFDs, but there is no similar foundation for the design of tractable DCs discovery algorithms.

Example 2

Consider the following constraint, c₆, which states that there cannot exist two persons who live in the same zip code and one person has a lower salary and higher tax rate.

∀t _(α) ,t _(β) ∈r, ^(┐)(t _(α)·ZIP=t _(β)·ZIP

t _(α)·SAL<t _(β)·SAL

t _(α)·TR>t _(β)·TR)c ₆  c₆:

is implied by c₂ and c₄: if two persons live in the same zip code, by c₂ they would live in the same state and by c₄ one cannot earn less and have higher tax rate in the same state.

In order to systematically identify implied DCs (such as c₆), for example, to prune some redundant DCs, a reasoning system for DCs needs to be built.

(2) Space Explosion

Consider a Functional Dependency (FD) discovery on schema R, let |R|=m. Taking an attribute as the right hand side of an FD, any subset of remaining m⁻¹ attributes could serve as the left hand side. Thus, the space to be explored for FDs discovery is m*2′⁻¹. Now consider discovering DCs involving at most two tuples; a predicate space needs to be defined, upon which the space of DCs is defined. The structure of a predicate consists of two different attributes and one operator. Given two tuples, we have 2 m distinct attributes; and six operators (=, ≠, >, ≦, <, ≧) are allowed. Therefore, the size of the predicate space P is: |P|=6*2 m*(2m−1). Any subset of the predicate space could constitute a DC. Therefore, the search space for DCs discovery is of size 2^(|P|).

Evidently, DCs discovery has a much larger space to explore, further justifying the need for a reasoning mechanism to enable efficient pruning, as well as the need for an efficient discovery algorithm.

(3) Ranking and Overfitting

Conventional model discovery algorithms suffer from the problem of overfitting; DCs discovered on the input instance I of schema R may not hold on future data of R. A discovered DC is said to be schema-conforming if it not only applies to current data, but also on future, unseen data. This is illustrated below in Example 3.

Example 3

Consider DC c₇ on Table 1 shown in FIG. 1, which states that first name determines gender.

∀t _(α) ,t _(β) ∈r, ^(┐)(t _(α)·FN=t _(β)·FN

t _(α)·GD≠t _(β)·GD)  c₇:

Even if c₇ is true on current data, common knowledge suggests that it does not hold in general.

Since the quality of ICs is crucial for data quality, discovered ICs are usually verified by domain experts for their validity. Statistical measures may be used to rank constraints and assist in the verification step for specific cases. For example, for CFDs it is possible to count the number of tuples that match their tableaux. Similar support measures are used for association rules.

Unfortunately, discovered DCs are more difficult to verify and rank than previous formalisms for three reasons: (1) similarly to FDs, it not possible to only count constants to measure support; (2) given the explosion of the space, the number of discovered DCs is much larger than the size of discovered FDs; (3) the semantics of FDs/CFDs is much easier to understand compared to DCs.

However, by looking carefully at the sample data, different kinds of evidence can be exploited to estimate if a DC is schema-conforming. For example, while both pairs of tuples t₄, t₇ and t₂, t₆ do not violate c₂, it is clear that t₄, t₇ gives more support for c₂.

Looking at the available data, the applicants see that there are two kinds of evidence that we can exploit to rank DCs effectively. The first one is the size of the constraints. Shorter DCs are easier to read and follow the Occam's razor principle: among competing hypotheses, the one making fewer assumptions is preferred. The second one is the support coming from the data. Every discovered DC holds on the entire dataset, and we cannot just count constants as for CFDs, therefore a more sophisticated definition of coverage is needed. For example, the measure should capture that c₂ has more coverage than c₇, because the pairs of tuples t₄; t₇ and t₁; t₈ give more support than any other pairs of tuples for c₂, while c₇ has only one pair t₁; t₆.

1.2 Discovering Denial Constraints

Given the DCs discovery problem and the above challenges, different embodiments of the present disclosure invention seek to provide the following three contributions:

1. A formal problem definition of discovering DCs. Static analysis for DCs is described below with three axioms that serve as the basis for an implication testing algorithm as well as for a DCs discovery algorithm. Determining whether a set of DCs implies another DC is un-decidable in general, an algorithm is therefore described below with linear time complexity for implication testing.

2. A DCs discovery algorithm, known as FASTDC, is described below. FASTDC starts by building a predicate space and calculates evidence sets for the predicate space. The connection between discovering minimal DCs and finding minimal set covers is then established for evidence sets. A depth-first search (DFS) strategy is employed for finding minimal set covers and DC axioms are used for branch pruning. In order to handle datasets that may have data errors, we extend the algorithm to discover approximate DCs.

3. A rank-based method which is a solution to the overfitting problem is described below and presents a novel scoring function for a DC. The scoring function is known herein as the “interestingness” of a DC which combines succinctness and coverage measures of discovered DCs in order to enable their ranking and pruning based on thresholds, thus reducing the cognitive burden for human verification.

The techniques are verified on real-life and synthetic data. The discussion below demonstrates that FASTDC is bound by the number of tuples |I| and by the number of DCs, and that the polynomial part with respect to |I| can be easily parallelized. The implication testing algorithm is shown to substantially reduce the number of DCs in the output, thus reducing users' effort in verifying discovered DCs.

1.3 Outline

Related technology is initially discussed below (Section 2). DCs and the problem definition of discovering DCs are then defined (Section 3), followed by their static analysis (Section 4). Details of the discovery algorithm FASTDC (Section 5) and of a scoring function (Section 6) are then described. Finally, an experimental study of the techniques (Section 7) is discussed.

2. Related Technology

The technology of an embodiment of the disclosure has similarities to several bodies of work: static analysis of FDs and CFDs, dependency discovery, and scoring of ICs. Whenever a dependency language is proposed, the static analysis should be investigated, including logical implication, consistency checking, and finite axiomatization. Static analysis for FDs is known and can be done in linear time with respect to the number of FDs. Three inferences rules are proven to be sound and complete.

Conditional functional dependencies (CFDs) were proposed when implication and consistency problems were shown to be intractable. In addition, a set of sound and complete inference rules were also provided, which were later simplified. Though denial constraints have been used for data cleaning as well as consistent query answering, static analysis has been done only for special fragments, such as currency rules. Dependency discovery has long been a subject of interest in communities of database, knowledge discovery and machine learning. Among the various topics of constraint discovery, FDs discovery attracted the most attention and whose methodology can be divided into schema-driven, top-down approaches and instance-driven, bottom-up approaches.

TANE is a representative for the schema-driven approach. It adopts a level-wise candidate generation and pruning strategy and relies on a linear algorithm for checking the validity of FDs. TANE is sensitive to the size of the schema. FASTFD is a representative for the instance-driven approach. It first computes agree-sets from data, then adopts a heuristic-driven depth first search algorithm to search for covers of agree-sets. FASTFD is sensitive to the size of the instance. Both algorithms were extended for discovering CFDs, which also includes a fast algorithm for constant CFDs discovery.

Another element of discovering ICs is to measure the importance of ICs according to a scoring function. In FDs discovery, the statistical correlations for each column pair are examined to discover soft FDs. In CFDs discovery some measures have been proposed, including support, which is defined as the percentage of the tuples in the data that match the pattern tableaux, conviction, and χ² test. However, none of these measures the extent to which the discovered ICs will conform to unseen data. Interest measures for CFDs are based on the matching of constant patterns in the input data, that is designed to reduce the amount of CFDs in the output. Therefore, the schema-conforming scoring function of an embodiment of the disclosure is fundamentally different from previously proposed scoring functions for discovered ICs.

3. Denial Constraint and Discovery Problem

In this section, the syntax and semantics of DCs are first reviewed. Then, minimal DCs are defined and the discovery problem for DCs is described.

3.1 Denial Constraints (DCs)

Syntax: Consider a database schema of the form S=(U,R,B) where U is a set of database domains, R is a set of database predicates or relations, and B is a set of finite built-in operators. In this paper, B={=, <, >, ≠, ≦, ≧,}. B must be negation closed to define the inverse of operator φ as φ.

The subset of integrity constraints identified by denial constraints (DCs) is supported over relational databases. Tuple based DC notation is used of the form:

∀t _(α) ,t _(β) ,t _(γ) , . . . ∈R, ^(┐)(P ₁

. . .

P _(m))  φ:

where P₁ is of the form v₁φv₂ or v₁φc with v₁, v₂∈t_(x)·A, x∈{α, β, γ, . . . }, A ∈R, and c is a constant. For the sake of simplicity, the above notation assumes there is only one relation R in R.

For a DC φ, if ∀P₁, i∈[1, m] is of the form v₁φv₂ then such DC is called a variable denial constraint (VDC), otherwise, φ is a constant denial constraint (CDC).

The inverse of predicate P: v₁ φ₁ v₂ is P: v₁-φ₂ v₂, where φ₂=φ₁. If P is true, then P is false. The set of implied predicates of P is Imp(P)={Q|Q: v₁ φ₂ v₂}, where φ₂ ∈Imp(φ₁). If P is true, then ∀Q∈Imp(P), Q is true. The inverse and implication of the six operators in B is summarized below in Table 2.

TABLE 2 φ = ≠ > < ≧ ≦ φ ≠ = ≦ ≧ < > Imp(φ) =, ≧, ≦ ≠ >, ≧, ≠ <, ≦, ≠ ≧ ≦

Semantics: Intuitively, a DC states that all the predicates cannot be true at the same time, otherwise there is a violation. Single-tuple constraints (such as SQL CHECK constraints), FDs, and CFDs are special cases of unary and binary denial constraints with equality and inequality predicates. Given a database instance I of schema S and a DC φ, if I satisfies φ, one writes I |=φ, and one says that φ is a valid DC. If there is a set of DC Σ, I |=Σ if and only if ∀_(φ)∈Σ, I |=φ. Σ implies φ, i.e., Σ|=φ, if for every instance I of S, if I |=Σ, then I |=φ.

The following description focuses on DCs with at most two tuples but it is to be appreciated that other embodiments of the disclosure are configured to operate on DCs with more than two tuples. DCs involving more tuples are, however, less likely in real life and incur bigger predicate space to search, as shown below in Section 5.

The universal quantifier for DCs with at most two tuples is ∀t_(α), t_(β). Universal quantifiers are omitted in the description below for simplicity purposes. The notations we use in the description are summarised below in Table 7.

TABLE 7 Symbol Meaning P, Q, R Single Predicate P, Q, R, W, X, Y Set of Predicates φ.Pres Set of Predicates in DC φ P_(—) _(i) A subset of predicates in P except P_(i) P Reverse each predicate in the set c, φ, φ Single DCs Σ, Γ Set of DCs

3.2 Problem Definition

In this subsection, trivial, minimal, and symmetric DCs are defined initially, and then the problem statement of discovering DCs is discussed.

Trivial, Minimal and Symmetric DC.

A DC ^(┐)(P₁

. . .

P_(n)) is said to be trivial if it is satisfied by any instance. In the description below, only nontrivial DCs are considered unless otherwise specified.

DC φ_(i) is said to be set-minimal, or minimal, if

φ₂, such that φ₁ |=φ₂, φ₂|⁼φ₁ and φ₂·Pres∪φ₁·Pres.

The symmetric DC of a DC φ₁ is a DC φ₂ by substituting t_(α) with t_(β), and t_(β) with t_(α).

THEOREM 1. If φ₁ and φ₂ are symmetric DCs, then φ₁ |=φ₂ and φ₂|=φ₁.

Example 4 described below illustrates above definitions.

Example 4

Consider three additional DCs for Table 1.

^(┐)(t _(α)·SAL=t _(β)·SAL

t _(α)·SAL>t _(β)·SAL)  c₁₀:

^(┐)(t _(α)·PH=t _(β)·PH))  c₁₁:

∀t _(α) ,t _(β) ∈r, ^(┐)(t _(α)·ST

t _(α)·SAL>t _(β)·SAL

t _(α)·TR<t _(β)·TR)  c₁₂:

c₁₀ is a trivial DC, since there cannot exist two persons that have the same salary, and one's salary is greater than the other. If tuple t_(x) in Table 1 is removed, c₁₁ becomes a valid DC, making c₁ no longer minimal. c₁₂ and c₄ are symmetric DCs.

A canonical cover of DCs on r is a set of minimal DCs on r, such that it is equivalent to all DCs that hold on r.

Problem Statement.

Given a relational schema R and an instance I, the discovery problem for DCs is to find a canonical cover of DCs that hold on I. Since the number of DCs that hold on a dataset is usually very big, the problem of ranking DCs with an objective function is described below in Section 6.

4. Static Analysis of Dcs

Since DCs subsume FDs and CFDs, it is natural to ask whether one can perform reasonings the same way as FDs or CFDs. Is there a sound and complete inference system for DCs? How hard is it to determine if a set of DCs implies another DC? These questions are relecant to discovering DCs because an inference system is needed for pruning DCs, and implication testing is required to reduce the number of DCs in the output.

4.1 Inference System

Armstrong Axioms for FDs are the fundamental building blocks for implication analysis for FDs. In this section three symbolic inference rules for DCs, denoted as I, analogous to Armstrong Axioms are discussed.

1. Triviality: ∀P_(i), P_(j) if P _(i) ∈Imp (P_(j)), then ^(┐)(P₁

P_(j)) is a trivial DC

2. Augmentation: If ^(┐)(P₁

. . .

P_(n)) is a valid DC, then ^(┐)(P₁

. . .

P_(n)

Q) is also a valid DC

3. Transitivity: If ^(┐)(P₁

. . .

P_(n)

Q₁) and ^(┐)(R₁

. . .

R_(m)

Q₂) are valid DCs, and Q₂∈Imp( Q ₁), then ^(┐)(P₁

. . .

P_(n)

R₁

. . .

R_(m)) is also a valid DC

Triviality states that if there are two predicates that cannot be true at the same time in a DC ( P ₁∈Imp(P_(j))), then the DC is trivially satisfied.

Augmentation states that if a DC is valid, adding more predicates will always result in a valid DC.

Transitivity states that if there are two DCs and two predicates (one in each DC) that cannot be false at the same time (Q₂ ∈Imp( Q ₁)), then merging two DCs plus removing those two predicates will result in a valid DC.

Since FDs are a subset of DCs, and Armstrong Axioms for FDs are well understood, we list in Table 3 (FIG. 2) FDs Axioms and their corresponding DCs forms to clarify DCs inference system I.

Inference system I is a syntactic way of checking whether a set of DCs Σ implies a DC φ. It is sound in that if by using I a DC φ can be derived from Σ, i.e., Σ├I φ then Σ implies φ, i.e., Σ

φ. The completeness of I dictates that if Σ

, then Σ├Iφ. We identify a specific form of DCs, for which I is complete. The specific form requires that each predicate of a DC is defined on two tuples and on the same attribute, and that all predicates must have the same operator θ except one that must have the reverse of θ.

Theorem 2.

The inference system I is sound for DCs. It is also complete for VDCs of the form ∀t_(α), t_(β)∈r, ^(┐)(P₁

. . .

P_(m)

Q), where P₁=t_(α)·A_(i)θt_(β)·A_(i), ∀i∈[1, m] and Q=t_(α)·B θt_(β)·B with A_(i), B∈U.

A formal proof of Theorem 2 is set out in FIG. 3. The completeness result for the inference system I for that form of DCs generalizes the completeness result of Armstrong Axioms for FDs. In particular, FDs adhere to the form with θ being =.

However, the discussion of the experiments indicates that, the axioms have an impact on the pruning power of the implication test and of the FASTDC algorithm.

The partial completeness result for the inference system has no implication on the completeness of the discovery algorithms described in Section 5. However, the experiments discuss that, although not complete, the inference system I has a huge impact on the pruning power of the implication test and of the FASTDC algorithm.

4.2 Implication Problem

Implication testing refers to the problem of determining whether a set of DC Θ implies another DC φ. It has been established that the complexity of the implication testing problem for DCs is coNP-Complete. Given the intractability result, a linear algorithm is described below for implication testing in order to reduce the number of DCs in the discovery algorithm output.

In order to devise an efficient implication testing algorithm, the concept of closure is defined in Definition 1 for a set of predicates W under a set of DCs Σ. A predicate P is in the closure if adding P to W would constitute a DC implied by Σ. This is similar to the closure of a set of attributes under a set of FDs.

Definition 1

The closure of a set of predicates W, with respect to a set of DCs Σ, is a set of predicates, denoted as Clo_(Σ)(W), such that ∀P∈Clo_(Σ)(W), Σ|=^(┐)(W

P).

Algorithm 1 calculates the partial closure of W under Σ, whose proof of correctness is set out in FIG. 4. Clo_(Σ)(W) by initialised by adding every predicate in W and their implied predicates due to Axiom Triviality (Lines 1-2). Additional predicates are added that are implied by Clo_(Σ)(W) through basic algebraic transitivity (Line 3). The closure is enlarged if there is a DC φ in Σ such that all but one predicates in φ are in the closure (Lines 15-23). Two lists are used to keep track of exactly when such condition is met (Lines 3-11).

Example 5

Consider Σ={c₁, . . . , c₆} and W={t_(α)·ZIP=t_(β)·ZIP, t_(α)·SAL<t_(β)·SAL}.

Algorithm 1 GET PARTIAL CLOSURE: Input: Set of DCs Σ, Set of Predicates W Output: Set of predicates called closure of W under Σ: Clo_(Σ)(W)  1: for all P ∈ W do  2: Clo_(Σ)(W) ← Clo_(Σ)(W)+ Imp(P)  3: Clo_(Σ)(W) ← Clo_(Σ)(W)+ Imp(Clo_(Σ)(W))  4: for each predicate P, create a list L_(P), which is the set of DCs    containing P  5: for each DC φ, create a list L_(φ), which is the set of predicates not yet    included in the closure  6: for all φ ∈ Σ do  7: for all P ∈φ.Pres do  8: L_(P)← L_(P) + φ  9: for all P ∉ Clo_(Σ)(W) do 10: for all φ ∈ L_(P) do 11: L_(φ) ← L_(φ) + P 12: create a list J, which is a queue of DC, which has all but one predicate    in the closure 13: for all φ ∈ Σ do 14: if |L_(φ) | = 1 then 15: J ← J + φ 16: while |J | > 0 do 17: φ ← J.pop( ) 18: P—← L_(φ).pop( ) 19: for all Q ∈ Imp( P ) do 20: for all φ ∈ L_(Q) do 21: L_(φ) ← L_(φ) − Q 22: if |L_(φ) | = 1 then 23: J ← 

 + φ 24: Clo_(Σ)(W)← Clo_(Σ)(W)+ Imp( P ) 25: Clo_(Σ)(W)← Clo_(Σ)(W) + Imp(Clo_(Σ)(W)) 26: return Clo_(Σ)(W)

The initialization step in Lines (1-3) results in Clo_(Σ) (W)={t_(α)·ZIP=t_(β)·ZIP, t_(α)·SAL<t_(β)·SAL, t_(α)·SAL t_(β)·SAL}. Now all predicates but one t_(α)·ST≠t_(β)·ST in c₂ are in the closure, the implied predicates of the reverse of t_(α)·ST≠t_(β)·ST are added to the closure. Clo_(Σ)(W)={t_(α)·ZIP=t_(β)·ZIP, t_(α)·SAL<t_(β)·SAL, t_(α)·SAL≦t_(β)·SAL, t_(α)·ST=t_(β)·ST}. Now c₄ is ready (Line 22), the implied predicates of the reverse t_(α)·TR>t_(β)·TR are added. The closure now is Clo_(Σ)(W)={t_(α)·ZIP=t_(β)·ZIP, t_(α)·SAL<t_(β)·SAL, t_(α)·SAL≦t_(β)·SAL, t_(α)·TR≦t_(β)·TR}. No more DCs are in the queue (Line 16). Taking the reverse of t_(α)·TR≦t_(β)·TR, the result is Σ|=c₇.

Algorithm 2 below tests whether a DC φ is implied by a set of DCs Σ by computing the closure of φ·Pres in φ under ┌, which is Σ enlarged with symmetric DCs. If there exists a DC φ in ┌, whose predicates are a subset of the closure, φ is implied by Σ. The proof of soundness of Algorithm 2 is set out below in FIG. 5. FIG. 5 also shows a counterexample where φ is indeed implied by Σ, but Algorithm 2 fails to verify because Algorithm 2 computes only a partial closure.

Example 6

Consider a database with two numerical columns, High (H) and Low (L). Consider two DCs c₁₄, c₁₅:

∀t _(α),(t _(α) ·H<t _(α) ·L)  c₁₄:

∀t _(α) ,t _(β)(t _(α) ·H>t _(β) ·H

t_(β) ·L>t _(α) ·H)  c₁₅:

The implication testing algorithm identifies how c₁₅ is implied by c₁₄. Let Σ={c₁₄} and W=c₁₅·Pres. ┌={c₁₄, c₁₆}, where c₁₆: ∀t_(β),(t_(β)·H<t_(β)·H)

Algorithm 2 IMPLICATION TESTING Input: Set of DCs Σ, one DC φ Output: A boolean value, indicating whether Σ |= φ 1: if φ is a trivial DC then 2: return true 3: Γ ← Σ 4: for φ ∈ Σ do 5: Γ ← Γ + symmetric DC of φ 6: Clo_(Γ) (φ.Pres) = getClosure(φ.Pres.Γ) 7: if ∃φ ∈ Γ, s.t. φ.Pres ⊂ Clo_(Γ)(φ.Pres) then 8: return true

Clo_(┌)(W)={t_(α)·H>t_(β)·H, t_(β)·L>t_(α)·H, t_(β)·H<t_(α)·H}, because t_(β)·H<t_(α)·H is implied by {t_(α)·H>t_(β)·H, t_(β)·L>t_(α)·H} through basic algebraic transitivity (Line 3). Since c₁₆·Pres⊂Clo_(┌)(W), thus the implication holds.

5. DCs Discovery Algorithm

This section describes the instance-driven discovery algorithm, FASTDC. FASTDC starts by analyzing the schema R to build a predicate space P. Given P, a space of candidate DCs is defined, which is of size 2^(|P|). Since checking each candidate DC against the input instance is quadratic in the number of tuples, it is unfeasible to validate each candidate DC individually. A method is described below that relies on evidence built from the input instance I for efficient discovery of only valid minimal DCs.

5.1 FASTDC

Algorithm 3 below describes a procedure for discovering minimal DCs. Since a DC is composed of a set of predicates, a predicate space P is built based on schema R (Line 1). Any subset of P could be a set of predicates for a DC.

Algorithm 3 FASTDC Input: One relational instance I, schema R Output: All minimal DCs Σ 1: P ← BUILD PREDICATE SPACE (I , R) 2: Evi_(I) ← BUILD EVIDENCE SET(I , P) 3: MC ← SEARCH MINIMAL COVERS(Evi_(I) , Evi_(I) , Ø, >_(init) , Ø ) 4: for all X ∈ MC do 5: Σ ← Σ+^(┐)( X) 6: for all φ ∈ Σ do 7: if Σ − φ |= φ then 8: remove φ from Σ

It is not feasible to validate each candidate DC directly over I, due to the quadratic complexity of checking all tuple pairs. For this reason, evidence is extracted from I in a way that enables the reduction of DCs discovery to a search problem that computes valid minimal DCs without checking each candidate DC individually.

The evidence that is extracted is composed of sets of satisfied predicates in P, one set for every pair of tuples (Line 2). For example, assume two satisfied predicates for one tuple pair: t_(α)·A=t_(β)·A and t_(α)·B=t_(β)·B. The set of satisfied predicates is used to derive the valid DCs that do not violate this tuple pair. In the example, if attributes A, B are of type string, there are five DCs that hold on that tuple pair, including ^(┐)(t_(α)·A≈t_(β)·A) and ^(┐)(t_(α)·A=t_(β)·A

t_(α)·B≠t_(β)·B). Let Evi_(I) be the sets of satisfied predicates for all pairs of tuples, deriving valid minimal DCs for I corresponds to finding the minimal sets of predicates for Evi_(I) (Line 3). For each minimal set, which is known as minimal cover (X in Algorithm 3), a valid minimal DC is derived by inverting each predicate in it (Lines 4-5). Finally, (lines 6-8) implied DCs are removed from Σ using Algorithm 2.

Section 5.2 describes the detailed procedure for building the predicate space P. Section 5.3 formally defines Evi_(I), gives a theorem that reduces the problem of discovering all minimal DCs to the problem of finding all minimal covers for Evi_(I), and presents a procedure for building Evi_(I). Section 5.4 describes a search procedure for finding minimal covers for Evi_(I). In order to reduce the execution time, the search is optimized with a dynamic ordering of predicates and branch pruning based on the axioms we developed in Section 4. In order to enable further pruning, Section 5.5 introduces an optimization technique that divides the space of DCs and performs DFS on each subspace.

5.2 Building the Predicate Space

Given a database schema R and an instance I, a predicate space P is built from which DCs can be formed as described below in Algorithm 4. For each attribute in the schema, two predicates are added which describe equality and inequality between two tuples on that attribute (Lines 1-2). In the same way, for each numerical attribute, order predicates are added (Lines 3-4). Every pair of attributes in R, are joinable if one can define equality predicates (=, ≠) on them, and comparable if one can define order predicates (>, ≦, <, ≧) on them. Cross column predicates are added for joinable column pairs (Lines 6-8). Cross column order predicates are added for comparable column pairs (Lines 10-12).

Algorithm 4 BUILDING PREDICATE SPACE Input: One relational instance I, schema R Output: Predicate space P  1: for all A ∈ R do  2: P ← t_(α).Aθt_(β).A, where θ ∈ {=, ≠}  3: if A is numerical type then  4: P ← P + tα .Aθtβ .A, where θ ∈ {>, ≦, <, ≧}  5: Profiling to find joinable column pairs EQColPairs  6: for all 

 A, B 

 ∈ EQColPairs do  7: P ← P + t_(α).Aθt_(α).B, where θ ∈ {=, ≠}  8: P ← P + t_(α).Aθt_(β).B, where θ ∈ {=, ≠}  9: Profiling to find comparable column pairs OrderColPairs 10: for all 

 A, B 

 ∈ OrderColPairs do 11: P ← P + t_(α).Aθt_(α).B, where θ ∈ {>, ≦, <, ≧} 12: P ← P + t_(α).Aθt_(β).B, where θ ∈ {>, ≦, <, ≧}

Example 7

Consider a small Employee Table with three attributes: Employee ID (I), Manager ID (M), and Salary(S).

I(String) M(String) S(Double) A1 A1 50 A2 A1 40 A3 A1 40 The following predicate space P can be built:

P₁: t_(α).I = t_(β).I P₅: t_(α).S = t_(β).S P₉: t_(α).S < t_(β).S P₂: t_(α).I ≠ t_(β).I P₆: t_(α).S ≠ t_(β).S P₁₀: t_(α).S ≧ t_(β).S P₃: t_(α).M = t_(β).M P₇: t_(α).S > t_(β).S P₁₁: t_(α).I = t_(α).M P₄: t_(α).M ≠ t_(β).M P₈: t_(α).S ≦ t_(β).S P₁₂: t_(α).I ≠ t_(α).M P₁₃: t_(α).I = t_(β).M P₁₄: t_(α).I ≠ t_(β).M

5.3 Evidence Set

This section, defines the formal definition of Evi_(I). A theorem is described that transforms the problem of minimal DCs discovery into the problem of searching for minimal set covers for Evi_(I). Finally, a procedure is described for computing Evi_(I). For example, the evidence set for the table in Example 7 is Evi_(I)={{P₂, P₃, P₅, P₈, P₁₀, P₁₂, P₁₄}, {P₂, P₃, P₆, P₈, P₉, P₁₂, P₁₄}, {P₂, P₃, P₆, P₇, P₁₀, P₁₁, P₁₃}}.

Definition 2. Evidence Set

-   -   Given a pair of tuple         t_(x),t_(y)         ∈|, the satisfied predicate set for         t_(x),t_(y)         is SAT (         t_(x),t_(y)         )={P|P∈P,         t_(x),t_(y)         |=P}, where P is the predicate space, and         t_(x),t_(y)         |=P means         t_(x),t_(y)         satisfies P.     -   The evidence set of I is Evi_(I)={SAT (         t_(x),t_(y)         ) |∀         t_(x),t_(y)         ∈I}.

The minimal cover for Evi_(I) is a set of predicates, that intersect with every SAT (

t_(x),t_(y)

) in Evi_(I).

Definition 3

A set of predicates X⊂P is a minimal cover for Evi_(I) if ∀E∈Evi_(I), x∩E≠Ø, and

Y⊂X, s·t·∀E∈Evi_(I), Y∩E≠Ø.

Theorem 3 transforms the problem of minimal DCs discovery into the problem of searching for minimal set covers for Evi_(I).

THEOREM 3. ^(┐)( X ₁

. . .

X _(n)) is a valid minimal DC if and only if X={X₁, . . . , X_(n)} is a minimal cover for Evi_(I).

Proof. Consider X⊂P, which is a cover of Evi_(I). According to the definition, Evi_(I) represents all the pieces of evidence that might violate DCs. For any E∈Evi_(I), there exists X∈X, X∈E; thus X∉E. In other words, the presence of X disqualifies E as a possible violation of any DC.

Example 8 shows an application of Theorem 3.

Example 8

Consider Evi_(I) built for the table in Example 7.

X₁={P₂} is a minimal cover, thus ^(┐)(P₂), i.e., ^(┐)(t_(α)·I=t_(β)·I) is a valid DC, which states I is a key.

X₂={P₁₀, P₁₄} is another minimal cover, thus ┐( P ₁₀

P ₁₄), i.e., ^(┐)(t_(α)·S<t_(β)·S

t_(α)·I=t_(β)·M) is another valid DC, which states that a manager's salary cannot be less than her employee's.

Algorithm 5 presents the procedure for building Evi_(I). This operation is sensitive to the size of the database, with a complexity of O(|P|×|r|²). However, the expensive loop (Lines 1-2) is easy to parallelize since each iteration is independent of each other. On a single machine with multi-core CPU, multi-thread computation is used. On a cluster, the task is distributed to all machines. The effect of parallelization will be demonstrated in Section 7.

Algorithm 5 BUILD EVIDENCE SET Input: One relational instance I, predicate space P Output: Evi_(I)  1: for Tuple t_(x) ∈ I do  2: for Tuple t_(y) ∈ I do  3: if t_(x) = t_(y) then  4: continue  5: SAT ←   6: for P ∈ P do  7: if 

 t_(x), t_(y) 

 |= P then  8: SAT ← SAT + P  9: if SAT ∉ Evi_(I) then 10: Evi_(I) ← Evi_(I) + SAT

5.4 DFS for Minimal Covers

Algorithm 6 below presents the depth-first search (DFS) procedure for minimal covers for Evi_(I) (Lines 9-10 are described later in Section 5.5). The evidence denoted by Evi_(curr) set is not covered so far. Initially Evi_(curr)=Evi_(I). Whenever a predicate P is added to the cover, the elements that contain P, i.e., Evi_(next)={E|E∈E_(curr)

P∉E} are removed from Evi_(curr) (Line 21). There are two base cases to terminate the search:

(i) when the search reaches a point where there are no more candidate predicates to include in the cover, but the current evidence set is still not empty (Lines 12-14); and

(ii) when the current evidence set is empty, the current path is a cover. After checking the minimality of the cover (Line 16), it is added to the set of all minimal covers MC (Lines 15-18).

The search procedure is speeded up by two important optimizations: dynamic ordering of predicates when descending down the search tree and branching pruning based on the axioms developed in Section 4.

Algorithm 6 Search Minimal Covers Input: 1. Input Evidence set, Evi_(I)  2. Evidence set not covered so far, Evi_(curr)  3. The current path in the search tree, X ⊂ P  4. The current partial ordering of the predicates, >_(curr)  5. The DCs discovered so far, Σ Output: A set of minimal covers for Evi, denoted as MC  1: Branch Pruning  2: P ← X.last  3: if ∃Q ∈ X − P, s.t. P ∈ Imp(Q) then  4: return //Triviality pruning  5: if ∃Y ∈ MC, s.t. X ⊃ Y then  6: return //Subset pruning based on MC  7: if ∃Y = {Y₁ , . . . , Y_(n) } ∈ MC, and ∃i ∈ [1, n], and ∃Q ∈    Imp(Y_(i) ), s.t. Z = Y_(−i) ∪ Q and X ⊃ Z then  8: return //Transitive pruning based on MC  9: if ∃φ ∈ Σ, s.t. X ⊃φ.Pres then 10: return //Subset pruning based on previous discovered DCs 11: Base cases 12: if >_(curr) =  and Evi_(curr) ≠  then 13: return //No DCs in this branch 14: if Evi_(curr) =  then 15: if no subset of size |X| − 1 covers Evi_(curr) then 16: MC ← MC + X 17: return //Got a cover 18: Recursive cases 19: for all Predicate P ∈>_(curr) do 20: X ← X + P 21: Evi_(next) ← remaining evidence sets in Evi_(curr) not yet covered by P 22: >_(next) ← the total ordering of {P′ |P >_(curr) P′} according to Evi_(next) 23: SEARCH MINIMAL COVERS( Evi_(I) , Evi_(next) , X, >_(next) , Σ) 24: X ← X − P

Opt1: Dynamic Ordering.

Instead of fixing the order of predicates when descending down the tree, the remaining candidate predicates, denoted as >_(curr), are ordered based on the number of remaining evidence set they cover. Formally, the cover of P is ordered with respect to Evi as Cov(P, Evi)=|{P∉E|E∈Evi}|. And P>Q if Cov(P, Evi)>Cov(Q, Evi), or Cov(P, Evi)=Cov(Q, Evi) and P appears before Q in the preassigned order in the predicate space.

Example 9

Consider the initial evidence set for the table in Example 7. The cover for each predicate is computed, such as Cov(P₂, Evi_(I))=3, Cov(P₈, Evi_(I))=2, Cov(P₉, Evi_(I))=1, etc. The initial ordering for all predicates according to Evi_(I) is >_(init)=P₂>P₃>P₆>P₈>P₁₀>P₁₂>P₁₄>P₅>P₇>P₉>P₁₁>P₁₃.

Opt2: Branch Pruning. The purpose of performing dynamic ordering of candidate predicates is to get covers as early as possible so that those covers can be used to prune unnecessary branches of the search tree. Three pruning strategies are described below.

-   -   (i) Lines (2-4) describe the first branch pruning strategy. This         branch would eventually result in the DC of the form φ:^(┐)( X−P         P         W), with predicate P being the most recent predicate added to         this branch and W being other predicates if this branch is         traversed. If P∈Imp( X−P), then φ is a trivially satisfied DC         according to Axiom Triviality.     -   (ii) Lines (5-6) describe the second branch pruning strategy,         which is based on MC. If Y is in the cover, then ^(┐)( Y) is a         valid DC. Any branch containing X would result in a DC of the         form ^(┐)( X         W), which is implied by ^(┐)( Y) based on Axiom Augmentation,         since Y ⊂ X.     -   (iii) Lines (7-8) describe the third branching pruning strategy,         which is also based on MC. If Y is in the cover, then ^(┐)( Y         _(−i)         Y _(i)) is a valid DC. Any branch containing X⊃Y_(−i)∪ Q would         result in a DC of the form ^(┐)( Y _(−i)         Q         W). Since Q∈Imp(Y_(i)), by applying Axiom Transitive on these         two DCs, it is revealed that ^(┐)( Y _(−i)         W) is also a valid DC, which would imply ^(┐)( Y ⁻¹         Q         W) based on Axiom Augmentation. Thus this branch can be pruned.

5.5 Dividing the Space of DCs

Instead of searching for all minimal DCs at once, the space of all DCs is divided into subspaces based on whether a DC contains a specific predicate P₁, which can be further divided according to whether a DC contains another specific predicate P₂.

This section describes how to discover minimal DCs in each subspace. A detailed strategy is described for dividing the DCs space, and the pruning opportunities identified by this operation.

In order to discover DCs that contain a predicate P, an evidence set module predicate P is defined, i.e., Evi_(I) ^(p) and a theorem is described that reduces searching DCs containing a predicate P into the problem of finding all minimal covers for Evi_(i) ^(p)

Definition 4

Given a P∈P, the evidence set of I module P is, Evi_(I) ^(p)={E−{P}|E∈Evi_(i), P∈E}

THEOREM 4. ^(┐)( X ₁

. . .

X _(n)

P) is a valid minimal DC, that contains predicate P, if and only if X={X₁, . . . , X_(n)}^(I) is a minimal cover for Evi_(I) ^(p).

Proof: Follow the same line of the proof for Theorem 3. Theorem 4 reduces the problem of discovering all minimal DCs Σ to the problem of finding all minimal covers of Evi_(I) ^(p) for each predicate P in the predicate space P.

Example 10

Consider Evi_(I) ^(I)Evi_(I) ^(p) ¹ =ØEvi_(I) ^(p) ¹³ ={{P₂, P₃, P₆, P₇, P₁₀, P₁₁}}. Thus ^(┐)(P₁) is a valid DC because there is nothing in the cover for Evi_(I), and ^(┐)(P₁₃

P₁₀ ) is a valid DC because {P₁₀} is a cover for Evi_(I) ^(p) ¹³ It is evident that Evi_(I) ^(p) is much smaller than Evi_(I).

However, care must be taken before starting to search for minimal covers for Evi_(I) ^(p) due to the following two problems.

First, a minimal DC containing a certain predicate P is not necessarily a global minimal DC. For instance, assume that ^(┐)(P, Q) is a minimal DC containing P because { Q} is a minimal cover for Evi_(I) ^(p). However, it might not be a minimal DC because it is possible that ^(┐)(Q), which is actually smaller than ^(┐)(P, Q), is also a valid DC. ^(┐)(P, Q) is a local minimal DC with respect to P, and ^(┐)(Q), a global minimal DC, or a minimal DC. A global minimal DC is always a local minimal DC with respect to each predicate in the DC. The goal is to generate all globally minimal DCs.

Second, assume that ^(┐)(P, Q) is a global minimal DC. It would appear as an output in Σ(P), as well in Σ(Q). A minimal DC φ would then appear in |φ·Pres| searches for minimal set covers, causing a large amount of repeated work.

The second problem is solved first, then, the solution for the first problem comes naturally. The DCs space is divided and all searches are ordered in a way, such to ensure that the output of a locally minimal DC is indeed global minimal, and a previously generated minimal DC will never appear again in latter searches. Consider a predicate space P that has only 4 predicates R₁ to R₄ as shown in FIG. 6, which presents a taxonomy of all DCs. In the first level, all DCs can be divided into DCs containing R₁, denoted as +R₁, and DCs not containing R₁, denoted as R₁. Since it is known how to search for local minimal DCs containing R₁, there is only a need to further process DCs not containing R₁, which can be divided based on containing R₂ or not, i.e., +R₂ and −R₂. −R₂, −R₃ are divided as in FIG. 6. Searching for DCs' not containing Ri can be enforced by disallowing Ri in the initial ordering of candidate predicates for minimal cover. Since this is a taxonomy of all DCs, no minimal DCs can be generated multiple times, thus solving the second problem mentioned above.

The first problem is solved by performing depth first searches according to the taxonomy tree in a bottom-up fashion. The method starts by searching for DCs containing R₄ and not containing R₁, R₂, R₃. Then the method searches for DCs, containing R₃, not containing R₁, R₂, and the method checks if the resulting DC is global minimal by checking if the reverse of the minimal cover is a super set of DCs already discovered from Evi_(I) ^(R) ⁴ . Then the method searches for DCs, containing R₂, not containing R₁, and checks if the resulting DC is global minimal by checking if the reverse of the minimal cover is a superset of DCs already discovered from Evi_(I) ^(R) ³ , Evi_(I) ^(R) ⁴ . The process goes on until it reaches the root of the taxonomy tree, thus ensuring that the results are both globally minimal and complete. Two additional optimization opportunities coming from dividing the DCs space are discussed below:

1. Reduction of Number of Searches. If ∃P∈P, such that Evi_(I) ^(p)=ø, the method identifies two scenarios for Q, where DFS for Evi_(I) ^(Q) can be eliminated.

(i) ∀Q∈Imp( P). If Evi_(I) ^(p)=ø, then ^(┐)(P) is a valid DC. The search for Evi_(i) ^(Q) would result in a DC of the form ^(┐)(Q

W), where W represents any other set of predicates. Since Q∈Imp( P), applying Axiom Transitivity, ^(┐)(W) is a valid DC, which implies ^(┐)(Q

W) based on Axiom Augmentation. (ii) ∀ Q∈Imp( P) Since Q∈Imp( P), then Q|=P, then Q

W|=P. Taking the contrapositive, the result is ^(┐)(P)|=^(┐)(Q

W).

Example 11

Consider Evi_(I) ^(p) since Evi_(I) ^(p) ¹ =ø and Evi_(I) ^(p) ⁴ =ø, then Q={P₁, P₂, P₃, P₄}. Thus the method only needs to perform |P|−|Q|=10 searches instead of |P|=14 searches.

2. Additional Branch Pruning. Since the method performs depth-first searches according to the taxonomy tree in a bottom-up fashion, DCs discovered from previous searches are used to prune branches in current DFS. Lines 9-10 of Algorithm 6 describe the additional branching pruning strategy: if φ is a valid DC discovered from previous searches, any branch containing X, such that X ⊃φ·Pres, would result in a DC of the form ^(┐)(φ·Pres

W), which is implied by φ based on Axiom Augmentation.

Since Algorithm 6 is an exhaustive search for all minimal covers for Evi_(I). Algorithm 3 will produce all minimal DCs that form a canonical cover.

THEOREM 5. Algorithm 3 produces a canonical cover of all non-trivial minimal DCs holding on input database I.

Complexity Analysis of FASTDC. The initialization of evidence sets takes O(|P|*n²). The time for each DFS search to find all covers for Evi_(I) ^(p), is O((1+w_(P))*K_(P)) with w_(P) being the extra effort due to imperfect search of Evi_(I) ^(p) and K_(P) being the number of minimal DCs containing predicate P. Altogether, the FASTDC algorithm has a worst time complexity of O(|P|*n₂+|P|*(1+w_(P))*K_(P)).

5.6 Approximate FASTDC: A-FASTDC

Algorithm FASTDC consumes the whole input data set and requires no violations for a discovered DC to be declared valid. In real scenarios, there are multiple reasons why this request may need to be relaxed:

-   -   (1) overfitting: data is dynamic and as more data becomes         available, overfitting constraints on current data set can be         problematic;     -   (2) data errors: while in general learning from unclean data is         a challenge, the common belief that errors constitute small         percentage of data, discovering constraints that hold for most         of the dataset is a common workaround.

To handle this requirement, we modify the discovery statement as follows: given a relational schema R and instance I, the approximate DCs discovery problem for DCs is to find a minimal cover Σ of valid DCs, where a DC φ is valid if the percentage of violations of φ on I, i.e., number of violations of φ on I divided by total number of tuple pairs |I| (|I|−1), is within threshold ∈. In this section, we describe, A-FASTDC, a variant of FASTDC for approximate DCs discovery.

Different tuple pairs might have the same satisfied predicate set. For every element E in Evi_(I), we denote by count(E) the number of tuple pairs

t_(x),t_(y)

such that E=SAT(

t_(x),t_(y)

). For example, count({P₂; P₃; P₆; P₈; P₉; P₁₂; P₁₄})=2 for the table in Example 7 since SAT(

t₁₀,t₉

)=SAT(

t₁₁,t₉

)={P₂; P₃; P₆; P₈; P₉; P₁₂; P₁₄}.

Definition 5

A set of predicates X⊂P is an ∈-minimal cover for Evi_(I) if Sum(count(E))≦∈|I|(|I|−1), where E∈Evi_(I), X∩E=0, and no subset of X has such property.

Theorem 6 transforms approximate DCs discovery problem into the problem of searching for ∈-minimal covers for Evi_(I).

THEOREM 6. ^(┐)( X ₁

. . .

X _(n)) is a valid approximate minimal DC if and only if X={X₁, . . . , X_(n)} is an ∈-minimal cover for Evi_(I).

There are two modifications for Algorithm 6 to search for ∈-minimal covers for Evi_(I): 1) the dynamic ordering of predicates is based on C_(ov)(P,Evi)=Σ_(E∈{E∈Evi, P∈E})count(E); and 2) the base cases (Lines 12-17) are either when the number of violations of the corresponding DC drops below ∈|I|(|I|−1), or the number of violations is still above ∈|I| (|I|−1) but there are no more candidate predicates to include. The detailed modifications for Algorithm 6 to search for c-minimal covers for Evi_(I) are shown in Algorithm 7 which is shown in FIG. 7.

6. Ranking DCS

Though our FASTDC is able to prune trivial, non-minimal, and implied DCs, the number of DCs returned can still be too large. To tackle this problem, we propose a scoring function to rank the returned DCs based on their size and their support from the data. Given a DC φ, its interestingness score is denoted by the Inter function as Inter (φ). The Inter score [Inter (φ)] is similar to a schema-conformance score. A DC is schema-conforming if it is verified on every valid instances of R.

We recognize two different dimensions that influence Inter(φ): succinctness and coverage of φ, which are both defined on a scale between 0 and 1. Each of the two scores represents a different yet important intuitive dimension that should be taken into account when ranking discovered DCs.

Succinctness is motivated by the Occam's razor principle. This principle suggests that among competing hypotheses, the one that makes fewer assumptions is preferred. It is also recognized that overfitting occurs when a model is excessively complex.

Coverage is a general principle in data mining to rank results and avoid overfitting. Scoring functions measure the statistical significance of the mining targets in the input data. The more evidence in the input data that supports a DC, the more likely this DC applies on unseen data.

Given a DC φ, the interestingness score is a linear weighted combination of the two dimensions:

Inter(φ)=a ₁×Succ(φ)+a ₂×Coverage(φ),a ₁ +a ₂=1

Experiments in Section 7 show that by combining both dimensions (succinctness and coverage of φ) the best results are achieved in terms of ranking discovered DCs. Succinctness and coverage are described in more detail below.

6.1 Succinctness

Minimum description length (MDL), which measures the code length needed to compress the data, is a formalism to realize the Occam's razor principle. Inspired by MDL, the length of a DC Len(φ) is measured, and the succinctness of a DC φ, i.e., Succ(φ), is defined as the minimal possible length of a DC divided by Len(φ) thus ensuring the scale of Succ(φ) is between 0 and 1.

${{Succ}(\phi)} = \frac{{Min}\left( \left\{ {{Len}(\varphi)} \middle| {\forall\varphi} \right\} \right)}{{Len}(\phi)}$

One simple heuristic for Len(φ) is to use the number of predicates in φ, i.e., |φ·Pres|. The function computes the length of a DC with a finer granularity than a simple counting of the predicates. To compute it, we identify the alphabet from which DCs are formed as A={t_(α), tβ, ∪, B}, where ∪ is the set of all attributes, and B is the set of all operators. The length of a DC φ is defined as the number of symbols in A that appear in φ: Len(φ)=|{a|a∈A, a∈φ}|. The minimal DC possible is of length 4, such as c₅ and c₁₇.

Example 12

Consider a database schema R with two columns A, B, with 3 DCs as follows:

^(┐)(t _(α) ·A=t_(β) ·A)  c₁₄:

^(┐)(t _(α) ·A=t_(β) ·B)  c₁₅:

^(┐)(t _(α) ·A=t_(β) ·A

t _(α) ·B≠t_(β) ·B)  c₁₆:

Len(c ₁₄)=4<Len(c ₁₅)=5<Len(c ₁₆)=6.

Succ(c ₁₄)=1,Succ₁₅=0.8, and Succ₁₆=0.67.

However, if |φ·Pres| is used as Len(φ), Len(c₁₄)=1<Len(c₁₅)=1<Len(c₁₆)=2, and Succ(c₁₄)=1, Succ(c₁₅)=1, and Succ(c₁₆)=0.5.

6.2 Coverage

Frequent itemset mining recognizes the importance of measuring statistical significance of the mining targets. In this case, the support of an itemset is defined as the proportion of transactions in the data that contain the itemset. Only if the support of an itemset is above a threshold, it is considered to be frequent. CFDs discovery also adopts such principle. A CFD is considered to be interesting only if their support in the data is above a certain threshold, where support is in general defined as the percentage of single tuples that match the constants in the pattern tableaux of the CFDs.

However, the above statistical significance measure requires the presence of constants in the mining targets. For example, the frequent itemsets are a set of items, which are constants. In CFDs discovery, a tuple is considered to support a CFD if that tuple matches the constants in the CFD. Our target VDCs lack constants, and so do FDs. Therefore, a different measure is needed for statistical significance of discovered DCs on I.

Example 13

Consider c₂, which is a FD, in Example 1. Looking at single tuple, just as the statistical measure for CFDs, every tuple matches c₂ since it does not have constants. However, the tuple pair

t₄,t₇

gives more support than the tuple pair

t₂,t₆

because

t₄,t₇

matches the left hand side of c₂.

Being a more general form than FDs, DCs have further evidence that can be exploited to give an accurate measure of the statistical significance of a DC on I.

An evidence of a DC φ is a pair of tuples that does not violate φ; there exists a predicate in φ that is not satisfied by the tuple pair. However, depending on the number of satisfied predicates, different evidences give different support to the statistical significance score of a DC. The larger the number of satisfied predicates is in a piece of evidence, the more support it should give to the schema-conformance score of φ. kE is defined as follows: where k is the number of satisfied predicates is k, and weight w(k) is given to kE, which is from 0 to 1, and increases with k.

Definition 5. Evidences and Weights

-   -   A kE of a DC φ with respect to a relational instance r is a         tuple pair         t_(x),t_(y)         , and the number of predicates satisfied by         t_(x),t_(y)         is k, where k≦|φ·Pres|−1.     -   The weight for kE of a DC φ is

${w(k)}\overset{.}{=}\frac{\left( {k + 1} \right)}{{\phi \cdot {Pres}}}$

Example 14

Consider c₈ in Example 3, which has 2 predicates. There are two types of evidences, i.e., 0E and 1E.

t₁,t₂

is a 0E since t₁·FN≠t₂·FN and t₁·GD=t₂·GD.

t₁,t₃

is a 1E since t₁·FN≠t₃·FN and t₁·GD≠t₃·GD.

t₁,t₆

is a 1E since t₁·FN=t₆·FN and t₁·GD=t₆·GD.

Clearly,

t₁,t₃

and

t₁,t₆

give more support about the schema-conformance score of c₈ than

t₁,t₂

.

Given such evidence, the coverage of a DC φ, Coverage(φ) is defined as follows:

${{Coverage}(\phi)} = \frac{\sum_{k = 0}^{{{\phi \cdot {Pres}}} - 1}{{{kE}}*{w(k)}}}{{I} \times \left( {{I} - 1} \right)}$

The enumerator of Coverage(φ) counts the number of different evidences weighted by their respective weights, which is divided by the total number of evidences. Coverage(φ) gives a score between 0 and 1, with higher score indicating higher statistical significance.

Example 15

Given 8 tuples in Table 1, there are 8*7=56 evidences. Coverage (c₈)=0.80357, Coverage(c₂)=0.9821. It can be seen that coverage score is more confident about c₂, thus reflecting our intuitive comparison between c₂ and c₈ in Section 1.

7.1 Datasets

Synthetic:

A Tax data generator is used in which each record represents an individual's address and tax information. The schema consists of 13 attributes: FName, LName, AreaCode, Mobile Phone, City, State, Zip, MaritalStatus, HasChild, Salary, TaxRate, SingleTaxExemp, ChildTaxExemp. The first nine attributes are of type string, the last four attributes are of numerical types (Integer or Double). The FName, LName are populated using a name database. The address information is populated using real semantic relationship. Furthermore, salary is synthetic, while tax rates and tax exemptions (based on salary, state, marital status and number of children) correspond to real life scenarios.

Real-World:

Two datasets are used from different Web sources:

-   -   1) Hospital data from the US federal government website. There         are 17 attributes, including Provider number (PN), State average         (SAVG), measure code (MC), measure name (MN), phone number         (PHO), etc. All of 17 attributes are string values.     -   2) SP Stock data extracted from historical S&P 500 Stocks. Each         record is arranged into fields representing the Date, Ticker,         Price of Open, High, Low, Close of the day, and Volume of the         day.

7.2 Scalability Evaluation

The Tax dataset is used to evaluate the running time of FASTDC by varying the number of tuples III, and the number of predicates IPI. As the building evidence set operation is expensive with large instances, it is shown that parallelizing this operation on a cluster leads to improvement depending on the number of machines in the cluster.

Algorithms: FASTDC was implemented in Java, and various optimization techniques were tested. FASTDC+M is used to represent running FASTDC on a cluster consisting of M machines. FASTDC-DS denotes running FASTDC without dividing the space of DCs as in Section 5.5. FASTDC-DO denotes running FASTDC without dynamic ordering of predicates in the search tree as in Section 5.4.

Exp-1: Scalability in |I|.

The running time on all 13 attributes is measured, by varying the number of tuples (up to a million tuples), as illustrated in FIG. 8a . The size of the predicate space |P| is 50. The Y axis of FIG. 8a is in log scale. We compare the running time of FASTDC and FASTDC+M. FIG. 8a shows a quadratic trend as the computation is dominated by the tuple pair-wise comparison for building the evidence set. In addition, FIG. 8a shows that we achieve almost linear improvement with respect to the number of machines on a cluster; for example, for 1M tuples, it took 3257 minutes on 7 machines, but 1228 minutes on 20 machines. Running FASTDC on a cluster is a viable approach if the number of tuples is too large to run on a single machine. There are two reasons for this improvement. First, the number of depth first searches is reduced. Second, inside each search, DCs discovered from previous searches are used to perform branch pruning.

Exp-2: Scalability in |P|.

The running time is measured in seconds using 10 k tuples, by varying the number of predicates picked from the attributes in Tax data, as in FIG. 8b . We compare the running time of FASTDC, FASTDC-DS, and FASTDCDO. The ordering of adding more attributes is randomly chosen and we report the average running time over 20 executions. The Y axes of FIGS. 8b, 8c and 8d are in log scale. FIG. 8b shows that the running time increases exponentially with respect to the number of predicates, especially when it involves numerical values. This is not surprising because the number of minimal DCs, as well as the amount of wasted work, increases exponentially with respect to the number of predicates, as shown in FIGS. 8c and 8d . By dividing DCs space, FASTDC can substantially reduce the amount of wasted work in DFS: for 50 predicates, the algorithm took 3500 seconds without the optimization.

The amount of wasted work is measured by the number of times Line 13 of Algorithm 6 is hit. The number of minimal DCs discovered is the same for FASTDC, FASTDC-DS, and FASTDC-DO as optimizations do not alter the discovered DCs. FASTDC is always more efficient than FASTDC-DS and FASTDC-DO.

For the Hospital dataset, the number of predicates is 34; and it took 118 minutes to run on a single machine using all tuples. For the SP Stock dataset, the number of predicates is 82; and it took 593 minutes to run on a single machine using all tuples.

Parallelization. The parallelization of the tuple pair-wise comparison of Algorithm 5 can lead to better execution times. The running time of FASTDC is compared on a single machine versus the running time on a cluster consisting of 4 machines. Distributing a tuple pair-wise comparison is a viable solution if a dataset is too large to run on a single machine. Smaller size (10 k-50 k), parallel execution does not achieve a “four times” improvement since the searching time for minimal covers takes up a large overhead. For larger datasets with sizes up to 90 k, a parallel version can achieve almost four times improvement because the dominant factor is the tuple pair-wise comparison.

Exp-3: Implication Reduction.

The number of DCs returned by FASTDC can be very large, and many of them are implied by others.

TABLE 4 Dataset #DCs Before #DCs After % Reduction Tax 1964 741 61% Hospital 157 42 73% SP Stock 829 621 25%

Table 4 shows the number of DCs before and after performing reduction through implication testing for all datasets. It can be seen that the implication testing algorithm, is able to prune a large amount of implied DCs.

7.3 Qualitative Analysis

Given an input instance I of a fixed schema R, it is desirable to discover schema-conforming DCs. First DCs discovered for different datasets are described. A scoring function is then described which is able to improve the precision and recall of returned DCs without user involvement. The scoring function (the Inter function) identifies interesting DCs. FASTDC can be run with 10 k tuples for each dataset using all available attributes.

Discovered DCs.

Table 5 shown in FIG. 9 shows sample DCs discovered in different datasets, with their semantics explained in English. It can be seen that FASTDC is able to discover meaningful DCs that are otherwise difficult to spot or design.

Scoring Function—the Inter function.

The number of computed DCs, even after implication reduction, is still too large for an exhaustive manual validation. Moreover, human evaluation may be impossible if domain experts are not available. To alleviate these problems, the Inter function can be used in two applications: to limit the manual verification to the k DCs with higher scores, or to prune the DCs whose score is lower than a threshold th.

Several metrics are introduced for qualitative assessments of the discovered DCs used in this section. We evaluate the two dimensions of the Inter function in Exp-4 and Exp-5 according to two different metrics. We report several discovered DCs by FASTDC that are non-trivial for users to design in Exp-6. We evaluate AFASTDC for noisy data in Exp-7. All experiments in this section are done on 100 k tuples for all datasets.

Parameters k and th. depend on the actual domain and can be fixed by the users. Users only need to verify Top-k DCs that are expected to be schema-conforming DCs with high precision, or they can set a threshold if domain experts for DCs verification are unavailable.

Metrics. We denote by Σ_(g) the gold standard DCs that are designed by

domain experts and are valid on the datasets. Specifically, Σ_(g) for the Tax dataset is designed by the present applicant; Σ_(g) for the Hospital dataset is retrieved from X. Chu, I. F. Ilyas, and P. Papotti. “Holistic data cleaning: Putting violations into context”. In ICDE, 2013.; and Σ_(g) for the SP Stock dataset have been designed by experts. Note that any DCs implied by Σ_(g) should also be considered as gold standard. The discovered DCs are denoted by Σ_(s), i.e. the DCs returned by FASTDC.

We define G-Precision, G-Recall, and G-F-Measure of Σ_(s) as the following:

${G\text{-}{{Precision}\left( \Sigma_{s} \right)}} = \frac{\left\{ {{\phi {{{\phi \in \Sigma_{s}},\Sigma_{g}}}} = \phi} \right\} }{\Sigma_{s}}$ ${G\text{-}{{Recall}\left( \Sigma_{s} \right)}} = \frac{\left\{ {{\phi {{{\phi \in \Sigma_{s}},\Sigma_{g}}}} = \phi} \right\} }{\Sigma_{g}}$ ${G\text{-}F\text{-}{{Measure}\left( \Sigma_{s} \right)}} = \frac{2*g\text{-}{{Precision}\left( \Sigma_{s} \right)}*g\text{-}{{Recall}\left( \Sigma_{s} \right)}}{{g\text{-}{{Precision}\left( \Sigma_{s} \right)}} + {g\text{-}{{Recall}\left( \Sigma_{s} \right)}}}$

Ranking-based Σ_(s). FIGS. 8e-h show G-Precision, G-Recall and G-F-Measure with respect to Σ_(g) for Tax and SP Stock data, with Σ_(s) being the Top-k DCs according to the Inter function. There are several possible observations from FIGS. 8e-h . First, precision is high for small values of k. Second, recall is close to one for small values of k and it increases with k, but with a descending degree. Therefore, most of the meaningful DCs is concentrated in Top-k according to the Inter function (scoring function) being the Top-k DCs according to succinctness, coverage and interestingness—hence the term “Inter” function.

By only returning Top-k DCs, many meaningful DCs are not missed. Third, results for the succinctness and coverage functions in isolation show that only by combining their scores best results are achieved in estimating the schema-conformance of DCs.

Notice that in FIG. 8e , the precision is less than 1 with k values smaller than 15 in the Tax dataset. However, this does not necessary imply that the DCs in Σ_(s) that are not implied by Σ_(g) are not schema-conforming. In fact, it turns out that they are also schema-conforming, but are not in Σ_(g) (because the expert was not aware of them) nor are implied by Σ_(g). DCs in Σ_(s) confirmed by domain experts to be schema-conforming are denoted by Σ_(u). For instance, the third entry in Table 5 shown in FIG. 9 is ranked fourth in Σ_(s), which is not in Σ_(g) nor implied by Σ_(g), but is schema-conforming.

The discovery output is measured with the U-Precision, which captures exactly if the DCs are schema-conforming. The U-Precision is defined as the percentage of DCs in Σ_(s) that are verified to be schema-conforming by domain experts. Domain experts might not be exhaustive in designing all gold DCs. DCs that are in Σ_(s) and are not implied by Σ_(g) might also be gold. We denote by Σ_(u) the DCs in Σ_(s) that are verified by domain experts to be gold. We define U-Precision as following:

${U\text{-}{{Precision}\left( \Sigma_{S} \right)}} = \frac{\Sigma_{u}}{\Sigma_{s}}$

Exp-4: Evaluation of Inter score. We report in FIGS. 8e-h G-Precision, G-Recall, and G-F-Measure for the Tax and the Hospital datasets, with Σ_(s) being the Top-k DCs according to succinctness, coverage and interestingness. Consider the Tax dataset, results using Inter function as in FIG. 8e are always better than those using succinctness alone as in FIG. 8f and those using coverage alone as in FIG. 8g . Moreover, FIG. 8e shows that Inter score with Top-20 DCs achieves perfect recall; while this is not the case for succinctness and coverage. This is due to two reasons. First, succinctness score blindly promotes shorter DCs that are not true in general, such as c₇ in Example 3. Second, coverage score might promote longer DCs that have higher coverage than shorter ones that have less coverage, however, those shorter DCs might be in Σ_(g); for example, the first entry in Table 6 has higher coverage than ^(┐)(t_(α)·AC=t_(β)·AC

t_(α)·PH=t_(β)·PH), which is actually in Σ_(g). For the Hospital dataset, interestingness and coverage give the same results as in FIG. 8h , which are considerably better than succinctness because gold DCs for the Hospital dataset are all FDs with two predicates, therefore succinctness has no effect on the interestingness. For the SP Stock dataset, all three scoring functions give the same results because gold DCs for this dataset are simpler DCs, such as ^(┐)(t_(α)·Low>t_(α)·High).

This experiment shows that both succinctness and coverage are useful in identifying interesting DCs. Combining both dimensions into Inter score achieves the best result in all cases.

TABLE 6 Dataset k = 5 k= 10 k = 15 k = 20 Tax 1.0 1.0 0.93 0.75 Hospital 1.0 1.0 0.93 0.7 SP Stock 1.0 1.0 1.0 1.0

Exp-5: U-Precision:

Table 6 shows the U-Precision for all datasets using the Top-k DCs as Σ_(s). For k=5 and k=10, they have U-Precision of 1.0. While in FIG. 8e , Top-5 and Top-15 G-precision values are less than 1.0. This is due to the fact that FASTDC is able to discover DCs that are gold standard but not easily designed by humans such as the second and third entry in Table 7.

TABLE 7 Sample DCs discovered in the datasets Dataset DC Discovered Semantics Tax

 (t_(α).ST = t_(β).ST 

 t_(α).SAL < There cannot exist two persons t_(β).SAL 

 t_(α).TR > t_(β).TR) who live in the same state, but one person earns less salary and has higher tax rate at the same time. Tax

 (t_(α).CH ≠ t_(β).CH 

 t_(α).STX < There cannot exist two persons t_(α).CTX 

 t_(β).STX < t_(β).CTX) with both having CTX higher than STX, but different CH. If a person has CTX, she must have children. Tax

 (t_(α).MS ≠ t_(β).MS 

 t_(α).STX = There cannot exist two persons t_(β).STX) 

 t_(α).STX > t_(α).CTX) with same STX, one person has higher STX than CTX and they have different MS. If a person has STX, she must be single. Hospital

 (t_(α).MC = t_(β).MC 

 t_(α).MN ≠ Measure code determines t_(β).MN) Measure name. Hospital

 (t_(α).PN = t_(β).PN 

 t_(α).PHO ≠ Provider number determines t_(β).PHO) Phone number. SP

 (t_(α).Open > t_(α).High) The open price of any stock Stock should not be greater than its high of the day. SP

 (t_(α).Date = t_(β).Date 

Ticker and Date is a composite Stock t_(α).Ticker = t_(β).Ticker) key.

Exp-6: Discovered DCs:

Table 7 reports some DCs discovered in different datasets, with their semantics explained in English. It can be seen that FASTDC is able to discover meaningful DCs that are otherwise difficult to spot or design.

Exp-7: A-FASTDC—Discovering Approximate Constraints in the Presence of Dirty Data:

We randomly inject 0.1% noise into the datasets and run A-FASTDC to verify that it discovers meaningful DCs in the presence of noise. Intuitively, A-FASTDC will not only discover gold DCs, but also DCs whose violation percentages happen to be within c. For example, ^(┐)(t_(α)·FN=t_(β)·FN

t_(α)·LN=t_(β)·LN) is discovered for the Tax data. FIGS. 8i-l plot the G-F-Measure for the Tax, the Hospital, and the SP Stock datasets. Given different approximation levels ∈, A-FASTDC is able to achieve reasonable F-Measure for all three datasets. However the results for the Hospital and the SP Stock datasets are better than the Tax datasets because the Tax dataset is richer in semantics. FIG. 8I shows the results for Top-40 DCs given a fixed ∈=0.6% while varying the number of tuples. It can be seen that c is independent of the database size.

Threshold-based Σ_(s): For real life datasets, an approach is to only return DCs whose U-Precision values are above a certain threshold. Table 8 reports the U-Precision values for all the DCs in Σ_(s) where their U-Precision value is above the threshold th.

TABLE 8 Dataset th = 0.85 th = 0.75 th = 0.65 Tax  1(1.0)  3(1.0) 12(0.92) Hospital  0(N/A) 13(1.0) 28(0.74) SP Stock 21(1.0) 23(1.0) 138(0.20) 

For each entry is reported the number of DCs in the sample and the precision value in parentheses. The scores give an accurate measure for the schema-conformance of the returned DCs.

Denial Constraints are a useful language formalism that can be used to detect violations, conduct sanity checks through data, clean data and enforce the correct data semantics. Denial Constraints are a useful language formalism to detect violations and enforce the correct application semantics. We have presented static analysis for DCs, including three sound axioms, and a linear implication testing algorithm. We also developed a DCs discovery algorithm (FASTDC), that can also discover approximate constraints in presence of dirty data. In addition, our interestingness score is very effective in identifying meaningful DCs. Our experiments demonstrated the effectiveness of our techniques in discovering interesting DCs. We have several directions to pursue in the future. We are developing algorithms for discovering DCs with constants and we want to investigate sampling techniques to alleviate the quadratic complexity of computing the evidence set.

When used in this specification and claims, the terms “comprises” and “comprising” and variations thereof mean that the specified features, steps or integers are included in an open ended manner. The terms are not to be interpreted to exclude the presence of other features, steps or components.

While particular embodiments have been illustrated and described herein, it should be understood that various other changes and modifications may be made without departing from the spirit and scope of the claimed subject matter. Moreover, although various aspects of the claimed subject matter have been described herein, such aspects need not be utilized in combination. It is therefore intended that the appended claims cover all such changes and modifications that are within the scope of the claimed subject matter. 

1. A computer implemented method of identifying denial constraints and correcting a database instance, the denial constraints being for use with a database schema R, the method comprising: generating candidate predicates using attributes of the database schema R; generating a predicate space P using the candidate predicates; determining a set of satisfied predicates using at least two tuples of the database instance, wherein the set of satisfied predicates are an evidence set; determining a minimal cover set for the satisfied predicates of the evidence set; deriving a set of valid denial constraints using the minimal cover set and inverse satisfied predicates for the minimal cover set; and correcting the database instance using the derived set of valid denial constraints.
 2. The method according to claim 1, wherein generating the predicate space P comprises: for each attribute in the schema R, adding equality predicates describing equality and inequality between two tuples of the database instance I on an attribute and adding cross column predicates for joinable column pairs, for each numerical attribute in the schema R, adding order predicates describing greater than, greater than or equal to, less than or equal to, or less than between two tuples on an attribute, and adding cross column order predicates for comparable column pairs wherein the joinable columns are columns comprising pairs of attributes of R which are equality predicates; and wherein the comparable columns are columns comprising pairs of attributes of R which are order predicates (>, ≦, <, ≧).
 3. The method according to claim 1, wherein generating the predicate space P comprises: for each attribute in the schema R, adding equality predicates describing equality and inequality between two tuples of the database instance I on an attribute and adding cross column predicates for joinable column pairs, for each numerical attribute in the schema R, adding order predicates describing greater than, greater than or equal to, less than or equal to, or less than between two tuples on an attribute, and adding cross column order predicates for comparable column pairs wherein the joinable columns are columns comprising pairs of attributes of R which are equality predicates; wherein the comparable columns are columns comprising pairs of attributes of R which are order predicates (>, ≦, <, ≧) and wherein the predicate space P is generated using the algorithm: Input: One relational instance I, schema R Output: Predicate space P  1: for all A ∈ R do  2: P ← t_(α).Aθt_(β).A, where θ ∈ {=, ≠}  3: if A is numerical type then  4: P ← P + tα .Aθtβ .A, where θ ∈ {>, ≦, <, ≧}  5: Profiling to find joinable column pairs EQColPairs  6: for all 

A, B 

 ∈ EQColPairs do  7: P ← P + t_(α).Aθ_(α).B, where θ ∈ {=, ≠}  8: P ← P + t_(α)Aθt_(β).B, where θ ∈ {=, ≠}  9: Profiling to find comparable column pairs OrderColPairs 10: for all 

 A, B 

 ∈ OrderColPairs do 11: P ←P + t_(α).Aθt_(α).B, where θ ∈ {>, ≦, <, ≧} 12: P ←P + t_(α).Aθt_(β).B, where θ ∈ {>, ≦, <, ≧}.


4. The method according to claim 1, wherein the evidence set Evi_(I), wherein Evi_(I) is the evidence set, is generated using the algorithm: Input: One relational instance I, predicate space P Output: Evi_(I)  1: for Tuple t_(x) ∈ I do  2: for Tuple t_(y) ∈ I do  3: if t_(x) = t_(y)then  4: continue  5: SAT ← ø  6: for P ∈ P do  7: if 

 t_(x) , t_(y) 

 |= P then  8: SAT ← SAT + P  9: if SAT ∈ Evi_(I) then 10: Evi_(I) ← Evi_(I) + SAT.


5. The method according claim 1, wherein the method further comprises dividing the space of the valid denial constraints into a plurality of subspaces that each comprise a first predicate P₁.
 6. The method according to claim 1, wherein the method further comprises dividing the space of the valid denial constraints into a plurality of subspaces that each comprise a first predicate P₁; and dividing the plurality of subspaces into a plurality of further subspaces that each comprise a second predicate P₂.
 7. The method according to claim 1, wherein the method further comprises ordering the valid denial constraints in a taxonomy tree according to the predicates in each denial constraint.
 8. The method according to claim 1, wherein the method further comprises ordering the valid denial constraints in a taxonomy tree according to the predicates in each denial constraint; and searching for denial constraints by searching the taxonomy tree from the bottom-up.
 9. The method according to claim 1, wherein the method further comprises ordering the valid denial constraints in a taxonomy tree according to the predicates in each denial constraint; searching for denial constraints by searching the taxonomy tree from the bottom-up; and pruning branches from the taxonomy tree which comprise valid denial constraints identified by the search and performing a further search of the taxonomy tree from the bottom-up.
 10. The method according to claim 1, wherein the method further comprises providing a scoring function to provide a ranking of discovered denial constraints.
 11. The method according to claim 1, wherein the method further comprises providing a scoring function to provide a ranking of discovered denial constraints; and the scoring function comprises assigning an interestingness score Inter(φ) to each denial constraint φ, the score Inter(φ) being a weighted combination of succinctness and coverage of each denial constraint φ.
 12. The method according to claim 1, wherein a U-Precision metric is provided which identifies whether a denial constraint is schema-conforming: ${{U\text{-}{{Precision}\left( \Sigma_{S} \right)}} = \frac{\Sigma_{u}}{\Sigma_{s}}},$ where the discovered DCs are denoted by Σ_(s) and Σ_(u) is the DCs in Σ_(s) that are verified as gold standard.
 13. The method according to claim 1, wherein the method further comprises providing a scoring function to provide a ranking of discovered denial constraints; the scoring function comprises assigning an interestingness score Inter(φ) to each denial constraint φ, the score Inter(φ) being a weighted combination of succinctness and coverage of each denial constraint φ; and wherein the succinctness is defined as: ${{Succ}(\phi)} = {\frac{{Min}\left( \left\{ {{Len}(\phi)} \middle| {\forall\varphi} \right\} \right)}{{Len}(\phi)}.}$
 14. The method according to claim 1, wherein the method further comprises providing a scoring function to provide a ranking of discovered denial constraints; the scoring function comprises assigning an interestingness score Inter(φ) to each denial constraint φ, the score Inter(φ) being a weighted combination of succinctness and coverage of each denial constraint φ; and wherein the coverage is defined as: ${{Coverage}(\phi)} = {\frac{\sum_{k = 0}^{{{\phi \cdot {Pres}}} - 1}{{{kE}}*{w(k)}}}{{I} \times \left( {{I} - 1} \right)}.}$
 15. The method according to claim 1, wherein, approximate DCs are identified by: given a relational schema R and instance I, finding a minimal cover Σ of valid DCs, where a DC φ is valid if the percentage of violations of φ on I, i.e., number of violations of φ on I divided by total number of tuple pairs |I|(|I|−1), is within a threshold ∈.
 16. A system operable to identify denial constraints and correct a database instance, the denial constraints being for use with a database schema R, the system comprising: a mechanism operable to generate candidate predicates using attributes of the database schema R and a predicate space P for an instance I in the schema R using the generated candidate predicates; a mechanism operable to determine a set of satisfied predicates using at least two tuples of the database instance I, wherein the satisfied predicates are an evidence set; a mechanism operable to identify a minimal set of predicates for the evidence set, and to identify valid denial constraints from the minimal set by inverting the predicates in the minimal set; and a mechanism to correct the database instance I using the identified denial constraints.
 17. The method according to claim 1, wherein the method further comprises providing a scoring function to provide a ranking of discovered denial constraints; the scoring function comprises assigning an interestingness score Inter(φ) to each denial constraint φ, the score Inter(φ) being a weighted combination of succinctness and coverage of each denial constraint φ; wherein the succinctness is defined as: ${{{Succ}(\phi)} = \frac{{Min}\left( \left\{ {{Len}(\varphi)} \middle| {\forall\varphi} \right\} \right)}{{Len}(\phi)}};$ and wherein the coverage is defined as: ${{Coverage}(\phi)} = {\frac{\sum_{k = 0}^{{{\phi \cdot {Pres}}} - 1}{{{kE}}*{w(k)}}}{{I} \times \left( {{I} - 1} \right)}.}$ 